﻿using SqlSugar;
using System;

namespace IconYuan.Model.Entity.Users
{

    [SugarTable("uc_user")]
    public class UserBase
    {
        /// <summary>
        /// 自增id
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public int user_id { get; set; }
        /// <summary>
        /// 手机号
        /// </summary>
        public string mobile { get; set; } = string.Empty;
        public string avatar { get; set; } = string.Empty;
        /// <summary>
        /// 账户余额
        /// </summary>
        public decimal balance { get; set; }
        /// <summary>
        /// 可用积分
        /// </summary>
        public int points { get; set; }
        /// <summary>
        /// 可用佣金
        /// </summary>
        public decimal brokerage { get; set; }
        /// <summary>
        /// 佣金比例
        /// </summary>
        public int brokerage_ratio { get; set; }
        /// <summary>
        /// 会员等级id
        /// </summary>
        public int grade_id { get; set; }
        /// <summary>
        /// 所属店铺
        /// </summary>
        public int store_id { get; set; }

        public DateTime create_time { get; set; }
        /// <summary>
        /// 过期时间
        /// </summary>
        public DateTime expire_time { get; set; }
        /// <summary>
        ///  管理员类型：0 会员,1 工作人员, 2 老板
        /// </summary>
        public int user_type { get; set; } = 0;
        /// <summary>
        /// 客户端ip
        /// </summary>
        public string ip { get; set; } = string.Empty;
        /// <summary>
        /// 优惠券金额
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public decimal coupon_money { get; set; }
        /// <summary>
        /// IP 归属地
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string ip_location { get; set; } = string.Empty;
    }

    /// <summary>
    /// 用户
    /// </summary>
    [SugarTable("uc_user")]
    public class User : UserBase
    {
        /// <summary>
        /// 头像ID
        /// </summary>
        public int avatar_id { get; set; }
        /// <summary>
        /// 用户昵称
        /// </summary>
        public string nick_name { get; set; } = string.Empty;
        /// <summary>
        /// 默认收货地址
        /// </summary>
        public int address_id { get; set; }
        /// <summary>
        /// 用户总支付的金额
        /// </summary>
        public decimal pay_money { get; set; }
        /// <summary>
        /// 是否删除
        /// </summary>
        public int is_delete { get; set; } = 0;
        /// <summary>
        /// 最后登录时间戳
        /// </summary>
        public DateTime last_time { get; set; }
        /// <summary>
        /// 上级id
        /// </summary>
        public int parent_id { get; set; } = 0;

        ///// <summary>
        ///// 自增id
        ///// </summary>
        //[SugarColumn(IsPrimaryKey = true)]
        //public int user_id { get; set; }
        ///// <summary>
        ///// 手机号
        ///// </summary>
        //public string mobile { get; set; } = string.Empty;
        //public string avatar { get; set; } = string.Empty;

        ///// <summary>
        ///// 账户余额
        ///// </summary>
        //public decimal balance { get; set; }
        ///// <summary>
        ///// 可用积分
        ///// </summary>
        //public int points { get; set; }
        ///// <summary>
        ///// 可用佣金
        ///// </summary>
        //public decimal brokerage { get; set; }
        ///// <summary>
        ///// 佣金比例
        ///// </summary>
        //public int brokerage_ratio { get; set; }
        ///// <summary>
        ///// 会员等级id
        ///// </summary>
        //public int grade_id { get; set; }
        ///// <summary>
        ///// 所属店铺
        ///// </summary>
        //public int store_id { get; set; }
        //public DateTime create_time { get; set; }
        ///// <summary>
        ///// 过期时间
        ///// </summary>
        //public DateTime expire_time { get; set; }
        ///// <summary>
        /////  管理员类型：0 会员,1 工作人员, 2 老板
        ///// </summary>
        //public int user_type { get; set; } = 0;

        ///// <summary>
        ///// 优惠券金额
        ///// </summary>
        //[SugarColumn(IsIgnore =true)]
        //public decimal coupon_money { get; set; }








        ///// <summary>
        ///// 实际消费的金额(不含退款)
        ///// </summary>
        //public decimal expend_money { get; set; }
        ///// <summary>
        ///// 省
        ///// </summary>
        //public string province { get; set; } = string.Empty;
        ///// <summary>
        ///// 城市
        ///// </summary>
        //public string city { get; set; } = string.Empty;
        /// <summary>
        /// 注册来源客户端 (APP、H5、小程序等)
        /// </summary>
        //public string platform { get; set; } = string.Empty;
        ///// <summary>
        ///// 微信openid(唯一标示)
        ///// </summary>
        //public string open_id { get; set; }
    }

}
